//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS MPA service.
///
/// Multi-party approval is a capability of Organizations that allows you to protect a predefined list of operations through a distributed approval process. Use Multi-party approval to establish approval workflows and transform security processes into team-based decisions.  When to use Multi-party approval:   You need to align with the Zero Trust principle of "never trust, always verify"   You need to make sure that the right humans have access to the right things in the right way   You need distributed decision-making for sensitive or critical operations   You need to protect against unintended operations on sensitive or critical resources   You need formal reviews and approvals for auditing or compliance reasons   For more information, see What is Multi-party approval in the Multi-party approval User Guide.
public struct MPA: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the MPA client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "MPA",
            serviceIdentifier: "mpa",
            serviceProtocol: .restjson,
            apiVersion: "2022-07-26",
            endpoint: endpoint,
            errorType: MPAErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Cancels an approval session. For more information, see Session in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func cancelSession(_ input: CancelSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CancelSessionResponse {
        try await self.client.execute(
            operation: "CancelSession", 
            path: "/sessions/{SessionArn}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Cancels an approval session. For more information, see Session in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - sessionArn: Amazon Resource Name (ARN) for the session.
    ///   - logger: Logger use during operation
    @inlinable
    public func cancelSession(
        sessionArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CancelSessionResponse {
        let input = CancelSessionRequest(
            sessionArn: sessionArn
        )
        return try await self.cancelSession(input, logger: logger)
    }

    /// Creates a new approval team. For more information, see Approval team in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func createApprovalTeam(_ input: CreateApprovalTeamRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateApprovalTeamResponse {
        try await self.client.execute(
            operation: "CreateApprovalTeam", 
            path: "/approval-teams", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new approval team. For more information, see Approval team in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - approvalStrategy: An ApprovalStrategy object. Contains details for how the team grants approval.
    ///   - approvers: An array of ApprovalTeamRequesterApprovers objects. Contains details for the approvers in the team.
    ///   - clientToken: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services populates this field.   What is idempotency?  When you make a mutating API request, the request typically returns a result before the operation's asynchronous workflows have completed. Operations might also time out or encounter other server issues before they complete, even though the request has already returned a result. This could make it difficult to determine whether the request succeeded or not, and could lead to multiple retries to ensure that the operation completes successfully. However, if the original request and the subsequent retries are successful, the operation is completed multiple times. This means that you might create more resources than you intended.  Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.
    ///   - description: Description for the team.
    ///   - name: Name of the team.
    ///   - policies: An array of PolicyReference objects. Contains a list of policies that define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    ///   - tags: Tags you want to attach to the team.
    ///   - logger: Logger use during operation
    @inlinable
    public func createApprovalTeam(
        approvalStrategy: ApprovalStrategy,
        approvers: [ApprovalTeamRequestApprover],
        clientToken: String? = CreateApprovalTeamRequest.idempotencyToken(),
        description: String,
        name: String,
        policies: [PolicyReference],
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateApprovalTeamResponse {
        let input = CreateApprovalTeamRequest(
            approvalStrategy: approvalStrategy, 
            approvers: approvers, 
            clientToken: clientToken, 
            description: description, 
            name: name, 
            policies: policies, 
            tags: tags
        )
        return try await self.createApprovalTeam(input, logger: logger)
    }

    /// Creates a new identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func createIdentitySource(_ input: CreateIdentitySourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateIdentitySourceResponse {
        try await self.client.execute(
            operation: "CreateIdentitySource", 
            path: "/identity-sources", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - clientToken: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services populates this field.   What is idempotency?  When you make a mutating API request, the request typically returns a result before the operation's asynchronous workflows have completed. Operations might also time out or encounter other server issues before they complete, even though the request has already returned a result. This could make it difficult to determine whether the request succeeded or not, and could lead to multiple retries to ensure that the operation completes successfully. However, if the original request and the subsequent retries are successful, the operation is completed multiple times. This means that you might create more resources than you intended.  Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.
    ///   - identitySourceParameters: A  IdentitySourceParameters object. Contains details for the resource that provides identities to the identity source. For example, an IAM Identity Center instance.
    ///   - tags: Tag you want to attach to the identity source.
    ///   - logger: Logger use during operation
    @inlinable
    public func createIdentitySource(
        clientToken: String? = CreateIdentitySourceRequest.idempotencyToken(),
        identitySourceParameters: IdentitySourceParameters,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateIdentitySourceResponse {
        let input = CreateIdentitySourceRequest(
            clientToken: clientToken, 
            identitySourceParameters: identitySourceParameters, 
            tags: tags
        )
        return try await self.createIdentitySource(input, logger: logger)
    }

    /// Deletes an identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func deleteIdentitySource(_ input: DeleteIdentitySourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteIdentitySource", 
            path: "/identity-sources/{IdentitySourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes an identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - identitySourceArn: Amazon Resource Name (ARN) for identity source.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteIdentitySource(
        identitySourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteIdentitySourceRequest(
            identitySourceArn: identitySourceArn
        )
        return try await self.deleteIdentitySource(input, logger: logger)
    }

    /// Deletes an inactive approval team. For more information, see Team health in the Multi-party approval User Guide. You can also use this operation to delete a team draft. For more information, see Interacting with drafts in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func deleteInactiveApprovalTeamVersion(_ input: DeleteInactiveApprovalTeamVersionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteInactiveApprovalTeamVersionResponse {
        try await self.client.execute(
            operation: "DeleteInactiveApprovalTeamVersion", 
            path: "/approval-teams/{Arn}/{VersionId}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes an inactive approval team. For more information, see Team health in the Multi-party approval User Guide. You can also use this operation to delete a team draft. For more information, see Interacting with drafts in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - arn: Amaazon Resource Name (ARN) for the team.
    ///   - versionId: Version ID for the team.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteInactiveApprovalTeamVersion(
        arn: String,
        versionId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteInactiveApprovalTeamVersionResponse {
        let input = DeleteInactiveApprovalTeamVersionRequest(
            arn: arn, 
            versionId: versionId
        )
        return try await self.deleteInactiveApprovalTeamVersion(input, logger: logger)
    }

    /// Returns details for an approval team.
    @Sendable
    @inlinable
    public func getApprovalTeam(_ input: GetApprovalTeamRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetApprovalTeamResponse {
        try await self.client.execute(
            operation: "GetApprovalTeam", 
            path: "/approval-teams/{Arn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details for an approval team.
    ///
    /// Parameters:
    ///   - arn: Amazon Resource Name (ARN) for the team.
    ///   - logger: Logger use during operation
    @inlinable
    public func getApprovalTeam(
        arn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetApprovalTeamResponse {
        let input = GetApprovalTeamRequest(
            arn: arn
        )
        return try await self.getApprovalTeam(input, logger: logger)
    }

    /// Returns details for an identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func getIdentitySource(_ input: GetIdentitySourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetIdentitySourceResponse {
        try await self.client.execute(
            operation: "GetIdentitySource", 
            path: "/identity-sources/{IdentitySourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details for an identity source. For more information, see Identity Source in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - identitySourceArn: Amazon Resource Name (ARN) for the identity source.
    ///   - logger: Logger use during operation
    @inlinable
    public func getIdentitySource(
        identitySourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetIdentitySourceResponse {
        let input = GetIdentitySourceRequest(
            identitySourceArn: identitySourceArn
        )
        return try await self.getIdentitySource(input, logger: logger)
    }

    /// Returns details for the version of a policy. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func getPolicyVersion(_ input: GetPolicyVersionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPolicyVersionResponse {
        try await self.client.execute(
            operation: "GetPolicyVersion", 
            path: "/policy-versions/{PolicyVersionArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details for the version of a policy. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - policyVersionArn: Amazon Resource Name (ARN) for the policy.
    ///   - logger: Logger use during operation
    @inlinable
    public func getPolicyVersion(
        policyVersionArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPolicyVersionResponse {
        let input = GetPolicyVersionRequest(
            policyVersionArn: policyVersionArn
        )
        return try await self.getPolicyVersion(input, logger: logger)
    }

    /// Returns details about a policy for a resource.
    @Sendable
    @inlinable
    public func getResourcePolicy(_ input: GetResourcePolicyRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetResourcePolicyResponse {
        try await self.client.execute(
            operation: "GetResourcePolicy", 
            path: "/GetResourcePolicy", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details about a policy for a resource.
    ///
    /// Parameters:
    ///   - policyName: Name of the policy.
    ///   - policyType: The type of policy.
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func getResourcePolicy(
        policyName: String,
        policyType: PolicyType,
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetResourcePolicyResponse {
        let input = GetResourcePolicyRequest(
            policyName: policyName, 
            policyType: policyType, 
            resourceArn: resourceArn
        )
        return try await self.getResourcePolicy(input, logger: logger)
    }

    /// Returns details for an approval session. For more information, see Session in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func getSession(_ input: GetSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetSessionResponse {
        try await self.client.execute(
            operation: "GetSession", 
            path: "/sessions/{SessionArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details for an approval session. For more information, see Session in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - sessionArn: Amazon Resource Name (ARN) for the session.
    ///   - logger: Logger use during operation
    @inlinable
    public func getSession(
        sessionArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetSessionResponse {
        let input = GetSessionRequest(
            sessionArn: sessionArn
        )
        return try await self.getSession(input, logger: logger)
    }

    /// Returns a list of approval teams.
    @Sendable
    @inlinable
    public func listApprovalTeams(_ input: ListApprovalTeamsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListApprovalTeamsResponse {
        try await self.client.execute(
            operation: "ListApprovalTeams", 
            path: "/approval-teams/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of approval teams.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - logger: Logger use during operation
    @inlinable
    public func listApprovalTeams(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListApprovalTeamsResponse {
        let input = ListApprovalTeamsRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listApprovalTeams(input, logger: logger)
    }

    /// Returns a list of identity sources. For more information, see Identity Source in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func listIdentitySources(_ input: ListIdentitySourcesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListIdentitySourcesResponse {
        try await self.client.execute(
            operation: "ListIdentitySources", 
            path: "/identity-sources/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of identity sources. For more information, see Identity Source in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - logger: Logger use during operation
    @inlinable
    public func listIdentitySources(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListIdentitySourcesResponse {
        let input = ListIdentitySourcesRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listIdentitySources(input, logger: logger)
    }

    /// Returns a list of policies. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func listPolicies(_ input: ListPoliciesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListPoliciesResponse {
        try await self.client.execute(
            operation: "ListPolicies", 
            path: "/policies/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of policies. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - logger: Logger use during operation
    @inlinable
    public func listPolicies(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListPoliciesResponse {
        let input = ListPoliciesRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listPolicies(input, logger: logger)
    }

    /// Returns a list of the versions for policies. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func listPolicyVersions(_ input: ListPolicyVersionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListPolicyVersionsResponse {
        try await self.client.execute(
            operation: "ListPolicyVersions", 
            path: "/policies/{PolicyArn}/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of the versions for policies. Policies define the permissions for team resources. The protected operation for a service integration might require specific permissions. For more information, see How other services work with Multi-party approval in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - policyArn: Amazon Resource Name (ARN) for the policy.
    ///   - logger: Logger use during operation
    @inlinable
    public func listPolicyVersions(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        policyArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListPolicyVersionsResponse {
        let input = ListPolicyVersionsRequest(
            maxResults: maxResults, 
            nextToken: nextToken, 
            policyArn: policyArn
        )
        return try await self.listPolicyVersions(input, logger: logger)
    }

    /// Returns a list of policies for a resource.
    @Sendable
    @inlinable
    public func listResourcePolicies(_ input: ListResourcePoliciesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListResourcePoliciesResponse {
        try await self.client.execute(
            operation: "ListResourcePolicies", 
            path: "/resource-policies/{ResourceArn}/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of policies for a resource.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func listResourcePolicies(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListResourcePoliciesResponse {
        let input = ListResourcePoliciesRequest(
            maxResults: maxResults, 
            nextToken: nextToken, 
            resourceArn: resourceArn
        )
        return try await self.listResourcePolicies(input, logger: logger)
    }

    /// Returns a list of approval sessions. For more information, see Session in the Multi-party approval User Guide.
    @Sendable
    @inlinable
    public func listSessions(_ input: ListSessionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListSessionsResponse {
        try await self.client.execute(
            operation: "ListSessions", 
            path: "/approval-teams/{ApprovalTeamArn}/sessions/?List", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of approval sessions. For more information, see Session in the Multi-party approval User Guide.
    ///
    /// Parameters:
    ///   - approvalTeamArn: Amazon Resource Name (ARN) for the approval team.
    ///   - filters: An array of Filter objects. Contains the filter to apply when listing sessions.
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - nextToken: If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.
    ///   - logger: Logger use during operation
    @inlinable
    public func listSessions(
        approvalTeamArn: String,
        filters: [Filter]? = nil,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListSessionsResponse {
        let input = ListSessionsRequest(
            approvalTeamArn: approvalTeamArn, 
            filters: filters, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listSessions(input, logger: logger)
    }

    /// Returns a list of the tags for a resource.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of the tags for a resource.
    ///
    /// Parameters:
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Starts the deletion process for an active approval team.   Deletions require team approval  Requests to delete an active team must be approved by the team.
    @Sendable
    @inlinable
    public func startActiveApprovalTeamDeletion(_ input: StartActiveApprovalTeamDeletionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StartActiveApprovalTeamDeletionResponse {
        try await self.client.execute(
            operation: "StartActiveApprovalTeamDeletion", 
            path: "/approval-teams/{Arn}?Delete", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Starts the deletion process for an active approval team.   Deletions require team approval  Requests to delete an active team must be approved by the team.
    ///
    /// Parameters:
    ///   - arn: Amazon Resource Name (ARN) for the team.
    ///   - pendingWindowDays: Number of days between when the team approves the delete request and when the team is deleted.
    ///   - logger: Logger use during operation
    @inlinable
    public func startActiveApprovalTeamDeletion(
        arn: String,
        pendingWindowDays: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartActiveApprovalTeamDeletionResponse {
        let input = StartActiveApprovalTeamDeletionRequest(
            arn: arn, 
            pendingWindowDays: pendingWindowDays
        )
        return try await self.startActiveApprovalTeamDeletion(input, logger: logger)
    }

    /// Creates or updates a resource tag. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates or updates a resource tag. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.
    ///
    /// Parameters:
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource you want to tag.
    ///   - tags: Tags that you have added to the specified resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes a resource tag. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes a resource tag. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.
    ///
    /// Parameters:
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource you want to untag.
    ///   - tagKeys: Array of tag key-value pairs that you want to untag.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates an approval team. You can request to update the team description, approval threshold, and approvers in the team.   Updates require team approval  Updates to an active team must be approved by the team.
    @Sendable
    @inlinable
    public func updateApprovalTeam(_ input: UpdateApprovalTeamRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateApprovalTeamResponse {
        try await self.client.execute(
            operation: "UpdateApprovalTeam", 
            path: "/approval-teams/{Arn}", 
            httpMethod: .PATCH, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates an approval team. You can request to update the team description, approval threshold, and approvers in the team.   Updates require team approval  Updates to an active team must be approved by the team.
    ///
    /// Parameters:
    ///   - approvalStrategy: An ApprovalStrategy object. Contains details for how the team grants approval.
    ///   - approvers: An array of ApprovalTeamRequestApprover objects. Contains details for the approvers in the team.
    ///   - arn: Amazon Resource Name (ARN) for the team.
    ///   - description: Description for the team.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateApprovalTeam(
        approvalStrategy: ApprovalStrategy? = nil,
        approvers: [ApprovalTeamRequestApprover]? = nil,
        arn: String,
        description: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateApprovalTeamResponse {
        let input = UpdateApprovalTeamRequest(
            approvalStrategy: approvalStrategy, 
            approvers: approvers, 
            arn: arn, 
            description: description
        )
        return try await self.updateApprovalTeam(input, logger: logger)
    }
}

extension MPA {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: MPA, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension MPA {
    /// Return PaginatorSequence for operation ``listApprovalTeams(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listApprovalTeamsPaginator(
        _ input: ListApprovalTeamsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListApprovalTeamsRequest, ListApprovalTeamsResponse> {
        return .init(
            input: input,
            command: self.listApprovalTeams,
            inputKey: \ListApprovalTeamsRequest.nextToken,
            outputKey: \ListApprovalTeamsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listApprovalTeams(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listApprovalTeamsPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListApprovalTeamsRequest, ListApprovalTeamsResponse> {
        let input = ListApprovalTeamsRequest(
            maxResults: maxResults
        )
        return self.listApprovalTeamsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listIdentitySources(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listIdentitySourcesPaginator(
        _ input: ListIdentitySourcesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListIdentitySourcesRequest, ListIdentitySourcesResponse> {
        return .init(
            input: input,
            command: self.listIdentitySources,
            inputKey: \ListIdentitySourcesRequest.nextToken,
            outputKey: \ListIdentitySourcesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listIdentitySources(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listIdentitySourcesPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListIdentitySourcesRequest, ListIdentitySourcesResponse> {
        let input = ListIdentitySourcesRequest(
            maxResults: maxResults
        )
        return self.listIdentitySourcesPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listPolicies(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listPoliciesPaginator(
        _ input: ListPoliciesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListPoliciesRequest, ListPoliciesResponse> {
        return .init(
            input: input,
            command: self.listPolicies,
            inputKey: \ListPoliciesRequest.nextToken,
            outputKey: \ListPoliciesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listPolicies(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listPoliciesPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListPoliciesRequest, ListPoliciesResponse> {
        let input = ListPoliciesRequest(
            maxResults: maxResults
        )
        return self.listPoliciesPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listPolicyVersions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listPolicyVersionsPaginator(
        _ input: ListPolicyVersionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListPolicyVersionsRequest, ListPolicyVersionsResponse> {
        return .init(
            input: input,
            command: self.listPolicyVersions,
            inputKey: \ListPolicyVersionsRequest.nextToken,
            outputKey: \ListPolicyVersionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listPolicyVersions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - policyArn: Amazon Resource Name (ARN) for the policy.
    ///   - logger: Logger used for logging
    @inlinable
    public func listPolicyVersionsPaginator(
        maxResults: Int? = nil,
        policyArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListPolicyVersionsRequest, ListPolicyVersionsResponse> {
        let input = ListPolicyVersionsRequest(
            maxResults: maxResults, 
            policyArn: policyArn
        )
        return self.listPolicyVersionsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listResourcePolicies(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourcePoliciesPaginator(
        _ input: ListResourcePoliciesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListResourcePoliciesRequest, ListResourcePoliciesResponse> {
        return .init(
            input: input,
            command: self.listResourcePolicies,
            inputKey: \ListResourcePoliciesRequest.nextToken,
            outputKey: \ListResourcePoliciesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listResourcePolicies(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - resourceArn: Amazon Resource Name (ARN) for the resource.
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourcePoliciesPaginator(
        maxResults: Int? = nil,
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListResourcePoliciesRequest, ListResourcePoliciesResponse> {
        let input = ListResourcePoliciesRequest(
            maxResults: maxResults, 
            resourceArn: resourceArn
        )
        return self.listResourcePoliciesPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listSessions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSessionsPaginator(
        _ input: ListSessionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListSessionsRequest, ListSessionsResponse> {
        return .init(
            input: input,
            command: self.listSessions,
            inputKey: \ListSessionsRequest.nextToken,
            outputKey: \ListSessionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listSessions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - approvalTeamArn: Amazon Resource Name (ARN) for the approval team.
    ///   - filters: An array of Filter objects. Contains the filter to apply when listing sessions.
    ///   - maxResults: The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listSessionsPaginator(
        approvalTeamArn: String,
        filters: [Filter]? = nil,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListSessionsRequest, ListSessionsResponse> {
        let input = ListSessionsRequest(
            approvalTeamArn: approvalTeamArn, 
            filters: filters, 
            maxResults: maxResults
        )
        return self.listSessionsPaginator(input, logger: logger)
    }
}

extension MPA.ListApprovalTeamsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListApprovalTeamsRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension MPA.ListIdentitySourcesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListIdentitySourcesRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension MPA.ListPoliciesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListPoliciesRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension MPA.ListPolicyVersionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListPolicyVersionsRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            policyArn: self.policyArn
        )
    }
}

extension MPA.ListResourcePoliciesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListResourcePoliciesRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            resourceArn: self.resourceArn
        )
    }
}

extension MPA.ListSessionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> MPA.ListSessionsRequest {
        return .init(
            approvalTeamArn: self.approvalTeamArn,
            filters: self.filters,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}
